import axios from 'axios';


function upload(path, userForm) {
    const params = new FormData()
    for (const i in userForm) {
        params.append(i, userForm[i])
    }
    // console.log(params);
    return axios.post(path, params, {
        headers: {
            // 按照表单数据来进行传输的
            // 与application/x-www-form-urlencoded的区别在于一个适合传字段键值，一个适合传文件。
            "Content-Type": "multipart/form-data"
        }
    }).then(res => res.data)
}




export default upload